import React, { Component ,Fragment} from "react";
// 类组件map

class App extends Component {
  state = {
    arr: ["张三", "李四", "王五"],
  };
  render() {
    return (
      <>
        <ul>
          {this.state.arr.map((item, index) => {
            return (
                // <li key={index}>{item}</li> 也可以
                // Fragment可以写Key
                <Fragment key={index}>
                    <li>{item}</li>
                </Fragment>
            );
          })}
        </ul>
      </>
    );
  }
}

export default App;
